﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System;

using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using SHDocVw;
using WatiN.Core;
using mshtml;
using DeathByCaptcha;

namespace WindowsFormsApplication4
{
    public class GetCaptcha
    {
        public static String un = "rsh5513568";
        public static String pw = "880327";
        Client ct = (Client)new SocketClient(un, pw);
        public static byte[] byt;
        private Element element;

        

        public GetCaptcha()
        {
            
        }

        public string  GetResult()
        {

            try
            {
                //double balance = ct.GetBalance();

                Captcha captcha = ct.Decode(GetCaptcha.byt, Client.DefaultTimeout);
                if (null != captcha)
                {
                    string result = captcha.Text;
                    return result;
                }
                else return "wrong";
            }
            catch (AccessDeniedException e)
            {
                return "na";
                /* Access to DBC API denied, check your credentials and/or balance */
            }

            catch (IOException e)
            {
                return "timeout";
            }

        }
    }
}
